﻿@{
    Layout = "_CustomerLayout";
    ViewData["Title"] = "密码修改";
    var customer = Model;
    ViewData["Name"] = customer.Name;
}
<link rel="stylesheet" href="~/author/layui/css/layui.css" media="all">
<div class="col-md-3 "> </div>
<div class="col-md-8 ">
    <div class="panel-body">
        <div class="col-md-8">
            <div class="login-content card">
                <div class="login-form">
                    <form id="changePWD" action='#")' method="post">
                        <div class="form-group">
                            <br />
                            <input name="id" type="text" class="form-control" value="@customer.Cid" readonly="readonly" onClick="{this.value='@customer.Cid'}">
                        </div>
                        <div class="form-group">
                            <br />
                            <input class="form-control" name="oldPwd" id="oldPwd" type="password" placeholder="输入旧密码">
                        </div>
                        <div class="form-group">
                            <br />
                            <input class="form-control" name="newPwd" id="newPwd" type="password" placeholder="输入新密码">
                        </div>
                        <div>
                            <input type="button" id="btn-nnnn" class="btn btn-primary btn-rounded m-b-10 m-l-5" value="提交修改" />
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>

@section Scripts{
    <script type="text/javascript">
        $("#btn-nnnn").click(function () {
            var oldPwd = $("#oldPwd").val();
            var newPwd = $("#newPwd").val();
            $.ajax({
                url: '/Customer/ChangePwd',
                data: { oldPwd: oldPwd, newPwd: newPwd },
                type: "POST",
                dataType: "JSON",
                success: function (data) {
                    if (data.code == 200 && data.msg != null) {
                        layer.alert(data.msg, { icon: 6 });
                    }
                    if (data.code == 503 && data.msg != null) {
                        layer.msg(data.msg, { icon: 5 });
                    }
                    if (data.code == 2050 && data.msg != null) {
                        layer.msg(data.msg, { icon: 5 });
                    }
                    if (data.code == 222 && data.msg != null) {
                        layer.msg(data.msg, { icon: 5 });
                    }
                }
            })
        })
    </script>
    <script src="~/author/layui/layui.all.js" charset="utf-8"></script>
    <script src="~/js/lib/sweetalert/sweetalert.min.js"></script>
    <script src="~/js/lib/sweetalert/sweetalert.init.js"></script>
}